import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BuildingVO, BuildingForm, BuildingQuery } from './types';

/**
 * 查询园区建筑信息列表
 * @param query
 * @returns {*}
 */

export const listBuilding = (query?: BuildingQuery): AxiosPromise<BuildingVO[]> => {
  return request({
    url: '/zichanguanli/building/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询园区建筑信息详细
 * @param id
 */
export const getBuilding = (query?: any): AxiosPromise<BuildingVO> => {
  return request({
    url: '/zichanguanli/building/query',
    method: 'get',
    params: query
  });
};

/**
 * 新增园区建筑信息
 * @param data
 */
export const addBuilding = (data: BuildingForm): AxiosPromise<string | number> => {
  return request({
    url: '/zichanguanli/building',
    method: 'post',
    data: data
  });
};

/**
 * 新增园区收租计划
 * @param data
 */
export const addParkRentCollectionPlan = (data: any): AxiosPromise<string | number> => {
  return request({
    url: '/zichanguanli/parkRentCollectionPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改园区收租计划
 * @param data
 */
export const updateParkRentCollectionPlan = (data: any): AxiosPromise<string | number> => {
  return request({
    url: '/zichanguanli/parkRentCollectionPlan',
    method: 'put',
    data: data
  });
};

/**
 * 修改园区收租计划
 * @param data
 */
export const parkRentCollectionPlanList = (query: any): AxiosPromise<string | number> => {
  return request({
    url: '/zichanguanli/parkRentCollectionPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 删除园区建筑信息
 * @param id
 */
export const delParkRentCollectionPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/parkRentCollectionPlan/' + id,
    method: 'delete'
  });
};

/**
 * 修改园区建筑信息
 * @param data
 */
export const updateBuilding = (data: BuildingForm) => {
  return request({
    url: '/zichanguanli/building',
    method: 'put',
    data: data
  });
};

/**
 * 删除园区建筑信息
 * @param id
 */
export const delBuilding = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/building/' + id,
    method: 'delete'
  });
};
